import time
import random
import json
import paho.mqtt.publish as publish

if __name__ == "__main__":

    while True:
        dic = {
            "temperature": random.uniform(-10, 45),
            "humidity": random.random(),
            "percentage": random.random()
        }
        data = bytes(json.dumps(dic), 'utf-8')
        publish.single("Diot_devecor", data, hostname="mqtt.eclipse.org")
        time.sleep(0.5)